import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
// 这个导入就会出错,不知道怎么来的
// import { component } from "vue/types/umd";

// 首页路由
const All = () => import("../views/All");
const User = () => import("../views/user/User");
//const Cart = () => import("../views/Cart");
const Cart = () => import("../views/cart/Index");
const BackstageHome = () => import("../views/backstage/BackstageHome");
const Login = () => import("../views/Login");
const Register = () => import("../views/Register");
const GoodsDetails = () => import('../views/goods/GoodsDetails');
const Pay = () =>import("../views/cart/Pay");

// 后台系统侧边栏路由
const Goods = () => import("../views/backstage/backstageSystem/Goods");
const Category = () => import("../views/backstage/backstageSystem/Category");
const DeliverComponey  = () => import("../views/backstage/backstageSystem/DeliverComponey");
const Deliver  = () => import("../views/backstage/backstageSystem/Deliver");
const Order = () => import("../views/backstage/backstageSystem/Order");
const Consumer = () => import("../views/backstage/backstageSystem/Consumer");
const Power = () => import("../views/backstage/backstageSystem/Power");
const Statistics = () => import("../views/backstage/backstageSystem/Statistics");
const SystemLog = () => import("../views/backstage/backstageSystem/SystemLog");
const Actor = () => import('../views/backstage/backstageSystem/Actor');
const Shop = () => import('../views/backstage/backstageSystem/Shop');



// 用户中心路由
const MyOrder = () => import("../views/user/userCenter/MyOrder");
const Information = () => import("../views/user/userCenter/Information");
const Address = () => import("../views/user/userCenter/Address");
const Discount = () => import("../views/user/userCenter/Discount");
const BuyService = () =>import("../views/user/userCenter/BuyService");

Vue.use(VueRouter);

const routes = [
  // 主页
  {
    path: "/",
    name: "Home",
    component: Home
  },
  // 关于
  {
    path: "/all",
    name: "All",
    component: All,

  },
  // 用户中心
  {
    path: "/user",
    name: "User",
    component: User,
    children:[
      {
        path:"/myorder",
        name:"MyOrder",
        component:MyOrder
      },
      {
        path:"/information",
        name:"Information",
        component:Information
      },
      {
        path:"/address",
        name:"Address",
        component:Address
      },
      {
        path:"/discount",
        name:"Discount",
        component:Discount
      },
      {
        path:"/buyservice",
        name:"BuyService",
        component:BuyService
      }
    ]
  },
  // 购物车
  {
    path: "/cart",
    name: "Cart",
    component: Cart
  },
  // 登录
  {
    path:"/login",
    name:"Login",
    component:Login
    
  },
  // 注册
  {
    path:"/register",
    name:"Register",
    component:Register
  },
 // 商品详情页
  {
    path:"/goods/details",
    name:"GoodsDetails",
    component:GoodsDetails
  },
  // 支付
  {
    path:"/cart/pay",
    name:"Pay",
    component:Pay
  },
  // 后台系统
  {
    path: "/backstagehome",
    name: "BackstageHome",
    component: BackstageHome,
    children: [
      // 商品列表
      {
        path: "/goods",
        name: "Goods",
        component: Goods
      },
      // 类目管理
      {
        path:"/category",
        name:"Category",
        component: Category
      },
      // 快递公司
      {
        path:"/delivercomponey",
        name:"DeliverComponey",
        component: DeliverComponey
      },
      // 快递列表
      {
        path:"/deliver",
        name:"Deliver",
        component: Deliver
      },
      // 订单管理
      {
        path:"/order",
        name:"Order",
        component: Order
      },
      // 订单统计
      {
        path:"/statistics",
        name:"Statistics",
        component: Statistics
      },
      // 用户管理
      {
        path:"/consumer",
        name:"Consumer",
        component: Consumer
      },
      // 角色管理
      {
        path:"/actor",
        name:"Actor",
        component:Actor
      },
      // 权限管理
      {
        path:"/power",
        name:"Power",
        component: Power
      },
      // 系统日志
      {
        path:"/systemlog",
        name:"SystemLog",
        component:SystemLog
      },
      {
        path:"/shop",
        name:"Shop",
        component:Shop
      }
    ]
  }
];

const router = new VueRouter({
  routes
});

export default router;
